<template>
  <!-- 基本信息 -->
  <div>
    <div class="title-wrapper">
      <title-name title="基本信息"></title-name>
    </div>
    <!-- 表单信息 -->
    <custom-form ref="ruleForm" isValidate :formList="formList" :form="form" :editModel="onlyRead ? 'V' : 'E'"
      :isEmit="false">
    </custom-form>
  </div>
</template>

<script>
export default {
  name: 'a' + Date.now(),
  components: {
  },
  props: {
    // 表单
    form: {
      type: Object,
      default: () => ({})
    },
    // 是否有填报人字段 填报时间
    isFillerName: {
      type: Boolean,
      default: true
    },
    // 只读模式
    onlyRead: {
      type: Boolean,
      default: () => false
    },
    orgTreeDisabled: {
      type: Boolean,
      default: () => false
    }
  },
  data() {
    return {
    }
  },
  created() {
  },
  computed: {
    // 表单配置项
    formList() {
      let list = []
      let list1 = [
        {
            label: '所属单位',
            type: 'orgTree',
            keyName: 'projectId',
            rules: [{ required: true, message: '请选择项目名称', trigger: 'change' }],
            isAutoSelectFirst:  true,
            isNeedAuth:true ,
            checkStrictly: true,
            disabled: this.orgTreeDisabled,
            isNoBorder: this.onlyRead,
            viewName: "viewName",
            span: 24,
            rule: { required: true, message: '请选择项目', trigger: 'change' }
        },
      ]
      let list2 = [
        {
            label: '所属单位',
            type: 'orgTree',
            keyName: 'projectId',
            rules: [{ required: true, message: '请选择项目名称', trigger: 'change' }],
            isAutoSelectFirst:  true,
            isNeedAuth:true ,
            checkStrictly: true,
            disabled: this.orgTreeDisabled,
            isNoBorder: this.onlyRead,
            viewName: "viewName",
            rule: { required: true, message: '请选择项目', trigger: 'change' }
        },
        {
          keyName: 'filler',
          type: 'a-input',
          disabled: true,
          label: '填报人',
        },
        {
          keyName: 'fillerDate',
          type: 'a-date-picker',
          placeholder: '请选择日期',
          disabled: true,
          label: '填报时间',
          attrs: {
            valueFormat: 'YYYY-MM-DD'
          }
        },
      ]
      if (this.isFillerName) {
        list = list2
      } else {
        list = list1
      }
      return list
    },
  },
  methods: {
  },
}
</script>

<style lang="less" scoped>
.title-wrapper {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  .titleName {
    margin: 0;
  }
  .anticon {
    margin-left: 5px;
    font-size: 18px;
  }
}
</style>